// 获取 字符串类型中的第一个字符
type StringFirstType<T extends string> = T extends `${infer R}${infer K}`
  ? R
  : T;

type ST1 = StringFirstType<"KIO">; // K
type ST2 = StringFirstType<"">; // ""

// 计算字符串类型的长度
// => 把 "12345" 转成 ["1", "2", "3", "4", "5"] 然后再 .legnth 就可以计算长度了
type StringLengthType<
  T extends string,
  Y extends string[] = []
> = T extends `${infer R}${infer K}`
  ? StringLengthType<K, [...Y, R]>
  : Y["length"];

type SL1 = StringLengthType<"123456">; // 6

export {};
